<template>
  <div class="item">
    <img :src="item.pic" />
    <div class="name">{{ item.title }}</div>
    <div class="rating">
      <div v-for="(r, index) of item.rat" :key="index">
        <img v-if="r > 1.5" src="../../../assets/icon/star.png" alt="" />
        <img v-else-if="r > 0.5" src="../../../assets/icon/ban.png" alt="" />
        <img v-else src="../../../assets/icon/none-star.png" alt="" />
      </div>
      <span>{{ item.rating }}</span>
    </div>
  </div>
</template>

<script>
export default {
  props: ["item"],
};
</script>

<style scoped>
.item {
  width: 230px;
  position: relative;
}

.item img {
  width: 100%;
  height: 340px;
}
.name {
  margin: 10px 0;
  font-size: 28px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}
.rating {
  display: flex;
  overflow: hidden;
}
.rating img {
  width: 20px;
  height: 20px;
}
.rating span {
  margin-left: 30px;
}
</style>